package com.lottery.game.core.utils;

import org.springframework.messaging.simp.stomp.StompHeaderAccessor;

import static com.lottery.game.common.constants.GameConstants.CHAT_ID;
import static com.lottery.game.common.constants.GameConstants.CHAT_TYPE;
import static com.lottery.game.common.constants.GameConstants.USER_ID;

public abstract class HeaderAcessorUtils {

	public static String getIfExistFromHeader(StompHeaderAccessor accessor, String key) {
		return accessor.getFirstNativeHeader(key);
	}

	public static String getChatId(StompHeaderAccessor accessor) {
		return getIfExistFromHeader(accessor, CHAT_ID);
	}

	public static String getChatType(StompHeaderAccessor accessor) {
		return getIfExistFromHeader(accessor, CHAT_TYPE);
	}

	public static String getUserId(StompHeaderAccessor accessor) {
		return getIfExistFromHeader(accessor, USER_ID);
	}

}
